
class Solution {
public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
        int numLen = nums.size();
        int left = 0;
        int right = 0;
        int resTmp = 0;
        while (left < numLen) {
            while (left < numLen && nums[left] != 1) {
                left++;
            }
            right = left;
            while (right < numLen && nums[right] == 1) {
                right++;
            }
            int lenNew = right - left;
            resTmp = lenNew > resTmp ? lenNew : resTmp;
            left = right + 1;
        }
        return resTmp;

    }
};